﻿using System;
using System.Collections.Generic;
using System.Text;
using static MAVLink;

namespace DroneLib
{
    public class GpsInfo
    {
        public static Dictionary<GPS_FIX_TYPE, string> GpsFixTypeString = new Dictionary<MAVLink.GPS_FIX_TYPE, string>
        {
            {GPS_FIX_TYPE.NO_GPS,"无GPS"},
            {GPS_FIX_TYPE.NO_FIX,"定位中"},
            {GPS_FIX_TYPE._2D_FIX,"二维定位" },
            {GPS_FIX_TYPE._3D_FIX,"三维定位" },
            {GPS_FIX_TYPE.DGPS,"差分定位" },
            {GPS_FIX_TYPE.RTK_FLOAT,"RTK 浮点" },
            {GPS_FIX_TYPE.RTK_FIXED,"RTK 定点" },
            {GPS_FIX_TYPE.STATIC,"静态" },
            {GPS_FIX_TYPE.PPP,"PPP" },
        };

        public GPS_FIX_TYPE GpsFixType { get; set; } = GPS_FIX_TYPE.NO_GPS;
        public GPS_FIX_TYPE GpsFixType2 { get; set; } = GPS_FIX_TYPE.NO_GPS;
        public int SatCount { get; set; }
        public int SatCount2 { get; set; }
        public float HDOP { get; set; }
        public float HDOP2 { get; set; }
        public float GDOP { get; set; }
        public float GDOP2 { get; set; }
        public float HAcc { get; set; }
        public float HAcc2 { get; set; }
        public float VAcc { get; set; }
        public float VAcc2 { get; set; }
        public float VelAcc { get; set; }
        public float VelAcc2 { get; set; }
        public float HdgAcc { get; set; }
        public float HdgAcc2 { get; set; }
        public float Yaw { get; set; }
        public float Yaw2 { get; set; }

        public override string ToString()
        {
            if (SatCount > 0)
                return $"{GpsFixTypeString[GpsFixType]} - {SatCount}星";
            else
                return $"{GpsFixTypeString[GpsFixType]}";
        }
    }
}
